#ifndef __STD_ERR_H__
#define __STD_ERR_H__

#ifdef __cplusplus
extern "C" {
#endif


/// 标准错误码
typedef int std_err_t;

#define STD_ERR_OK                0    	/*!< OK (no error) */
#define STD_ERR_FAIL              -1    /*!< Generic failure */

#define STD_ERR_NO_MEM            -2    /*!< Out of memory */
#define STD_ERR_INVALID_ARG       -3    /*!< Invalid argument */
#define STD_ERR_INVALID_STATE     -4    /*!< Invalid state */
#define STD_ERR_INVALID_SIZE      -5    /*!< Invalid size */
#define STD_ERR_NOT_FOUND         -6    /*!< Requested resource not found */
#define STD_ERR_NOT_SUPPORTED     -7    /*!< Operation or feature not supported */
#define STD_ERR_TIMEOUT           -8    /*!< Operation timed out */
#define STD_ERR_INVALID_RESPONSE  -9  	/*!< Received response was invalid */
#define STD_ERR_INVALID_CRC       -10  	/*!< CRC or checksum was invalid */
#define STD_ERR_INVALID_VERSION   -11   /*!< Version was invalid */
#define STD_ERR_INVALID_MAC       -12  	/*!< MAC address was invalid */

#define STD_ERR_INVALID_IF_TYPE   -13   /*!< Interface type was invalid */
#define STD_ERR_INVALID_SRC_ADDR  -14   /*!< Source address was invalid */
#define STD_ERR_INVALID_DST_ADDR  -15   /*!< Destination address was invalid */
#define STD_ERR_INVALID_FRAME_LEN -16   /*!< Invalid frame length */
#define STD_ERR_INVALID_PARAM_LEN -17   /*!< Invalid parameter length */
#define STD_ERR_BUFFER_OVERFLOW   -18   /*!< Buffer overflow */
#define STD_ERR_BUFFER_UNDERFLOW  -19   /*!< Buffer underflow */
#define STD_ERR_INVALID_COMMAND   -20   /*!< Invalid command */

#define STD_ERR_EOF               -21   /*!< End of file */
#define STD_ERR_UNCLOSED_STRING   -22   /*!< Unclosed string */
#define STD_ERR_ILLEGAL_CHAR      -23   /*!< Illegal character */
#define STD_ERR_TOO_MUCH_CMDPARTS -24   /*!< Too much command parts */
#define STD_ERR_TOO_MUCH_CMDARGS  -25   /*!< Too much command args */
#define STD_ERR_TOO_LARGE_STR     -26   /*!< Too large string arg */

// 获取错误码对应的错误名称
const char* std_err_name(std_err_t err);
// 获取错误码对应的错误说明
const char* std_err_comment(std_err_t err);


#ifdef __cplusplus
}
#endif

#endif // __STD_ERR_H__
